package Demo2;

public class Test {
    public static void eat(Animal animal){
        animal.eat();
    }

    public static void running(IRunable runnable){
        runnable.run();
    }
    public static void flying(IFlyable flyable){
        flyable.fly();
    }
    public static void swimming(ISwimmable swimmable){
        swimmable.swim();
    }

    public static void main(String[] args) {
        Dog dog = new Dog("布鲁斯",5);
        Bird bird = new Bird("球球",2);
        Fish fish = new Fish("哈哈",3);

        eat(dog);
        eat(bird);
        eat(fish);
        System.out.println("===========");
        running(dog);
        running(bird);
        System.out.println("===========");
        flying(bird);
        System.out.println("===========");
        swimming(dog);
        swimming(fish);
    }
}
